<script setup>
import zhCn from 'element-plus/dist/locale/zh-cn.mjs';
import { useThemeStore } from '@/store';
import { storage } from '@/utils/storage';

const themeStore = useThemeStore();

const setDefaultTheme = () => {
  themeStore.setMenuMode(themeStore.menuMode);

  const themeSetting = storage.get('themeSetting');

  if (themeSetting?.isDark) {
    themeStore.setIsDark(true);
  }

  if (themeSetting?.themeColor) {
    themeStore.setThemeColor(themeSetting?.themeColor);
  }
};
setDefaultTheme();
</script>
<template>
  <el-config-provider :locale="zhCn">
    <router-view />
  </el-config-provider>
</template>
